package org.mwiki.scala.bot

import dispatch._
import _root_.scala.xml._
import http.actions.Query
import http.MwRequest

object App {
  def main(args: Array[String]) {

    var title = "Хімія"
    val cats = MwRequest.request(Query.categoryMembers(title))

    //    val response = MwRequest.request(Query.siteInfo())
    println(cats)
    val xml: Elem = XML.loadString(cats)

    val members = xml \\ "query" \ "categorymembers"

//    members.elements.map()

  }

  def parseStat(xml: Elem) {
    val statistics = xml \\ "statistics"
    val attrs = statistics.first.attributes

    //    val map = attrs.map[Map[String,Seq[Node]]](x => Map(x.key -> x(x.key)) )
    for (x <- attrs) {
      println(x.key + "=" + x(x.key))
    }

  }


}


